<?php
use backend\assets\AgentAsset;
use yii\bootstrap\ActiveForm;

AgentAsset::register($this);
$this->registerJsFile("@web/system/employee/add.js",['position'=>$this::POS_END]);
?>
<style>
	.myclass{
		top: 15px;
		left: -300px;
	}
	.form_position{
		position: relative;
		top:50px;
		margin: 0 20px;
	}
	.form-group{
		padding-bottom:20px;
		margin-bottom: 5px;
	}
	.tab_position{
	}
</style>
<div class="main form_position">
	<div class="hide"><iframe name='send_post' id='send_post'></iframe></div>
	<?php ActiveForm::begin(['options'=>['target'=>'send_post','name'=>'register']])?>
	  <div class="form-group">
		  <label for="staff_name" class="tab_label">员工姓名:</label>
	    <input type="text" class="form-control tab_input"  name="staff_name" id="staff_name" >
	  </div>
	  <div class="clearfix"></div>
	  <div class="form-group ">
	    <label for="staff_mobile" class="tab_label">电话:</label>
	    <input type="text" class="form-control tab_input" id="staff_mobile" name="staff_mobile">
	  </div>
	  <div class="clearfix"></div>
	  <div class="form-group tab_position">
		 <span class="btnBg ml20" style="width:130px; height:42px;line-height: 42px;color: #fff;border-radius: 6px; ">
			<input type="submit" value="确定" style="display: block; width: 100%; background: 0; border:0;">
		</span>
		<span class="btnBg ml20 bg_rest " style="width:130px; height:42px; line-height: 42px; color: #fff;border-radius: 6px;">
			<input type="reset" value="取消" style="display: block; width: 100%; background: 0;border:0; " />
		</span>
	  </div>
	<?php ActiveForm::end(); ?>
</div>

<?php $this->beginBlock('js_index_end') ?>
	$(function(){
		$('form[name="register"]').validator({
		focusCleanup: true,
		stopOnError:false,
		//debug: true,
		timely: 2,
		//自定义规则（PS：建议尽量在全局配置中定义规则，统一管理）
		rules: {
			length: [/^\S{0,5}$/, '请输入小于等于5个字符的内容']
		},
		msgClass: "n-bottom myclass",
		fields: {
		'staff_name': 'required; length;',
		'staff_mobile': 'mobile'
		}
		});
		var index = parent.layer.getFrameIndex(window.name);

			$('input[type="reset"]').click(function(){
		  	parent.layer.close(index);
		})
	})
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['js_index_end'], $this::POS_END); ?>